/**
  ******************************************************************************
  * @文件名           : dri_HMI.c
  * @作者             : citunhk
  * @功能介绍         : HMI通讯接收，以及相应的命令处理及返回
  *	@日期             : 2022.10.31
  ******************************************************************************
  * @注意
  *
  *
  *
  ******************************************************************************
  *更改记录
  *日期 修改人 修改内容
  *
  *
  *
  ******************************************************************************
  */
#include "dri_HMI.h"
#include "bsp_usart.h"
#include "fml_crc.h"
#include "sys_data.h"
#include "dri_flash_sst.h"

uint8_t pBus232_HMI_TxBuffer[RS232_SALVER_TX_NUM];
uint8_t gBus232_HMI_RxBuffer[RS232_SLAVER_RX_NUM];
uint8_t gBus232_HMI_RxCounter=0x00;   //HMI接收计数
uint8_t pBus232_HMI_TxCounter=0x00;   //HMI发送计数

/**
* @函数名	DRI_MakeModbusHMIUpMsgCrc
* @功能	    生成向HMI发送数组中的CRC，低字节在前
* @入口参数	无
* @返回值	无
*/
void DRI_MakeModbusHMIUpMsgCrc(void)
{
	uint16_t uiCRCResult;

//	Crc16Arg.pCrc16ArgsPuchMsg=pBus232_HMI_TxBuffer;
//	Crc16Arg.crc16ArgsPuchMsgLen=pBus232_HMI_TxCounter;

	uiCRCResult = Crc16(pBus232_HMI_TxBuffer,pBus232_HMI_TxCounter);
//	uiCRCResult=Crc16Arg.returnValue;

	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=uiCRCResult&0x00FF;
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=uiCRCResult>>8;
}

uint16_t DRI_TxRegSwitchTo500(unsigned int uiRegIndex)
{
	uint16_t pModbusHMIUpData = 0;
	switch(uiRegIndex)
	{
		case 0:
			pModbusHMIUpData=rState_Chiller;//设备状态组
			break;
		case 1:
			pModbusHMIUpData=rState_Alarm1;//报警状态组1
			break;
		case 2:
			pModbusHMIUpData=rState_Alarm2;//报警状态组2
			break;
		case 3:
			pModbusHMIUpData=rState_Alarm3;//报警状态组3
			break;
		case 4:
			pModbusHMIUpData=rState_Alarm4;//报警状态组4
			break;
		case 5:
			utf.f = gPV_TTemp1;//主温度单位转换实测值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 6:
			utf.f = gPV_TTemp1;//主温度单位转换实测值
			pModbusHMIUpData=utf.u;
			break;
		case 7:
			utf.f = gPV_TTemp2;//辅温度单位转换实测值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 8:
			utf.f = gPV_TTemp2;//辅温度单位转换实测值
			pModbusHMIUpData=utf.u;
			break;
		case 9:
			utf.f = gPV_TTempAbmi;//环境温度单位转换实测值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 10:
			utf.f = gPV_TTempAbmi;//环境温度单位转换实测值
			pModbusHMIUpData=utf.u;
			break;
		case 11:
			utf.f = gPV_TFlow;//流量单位转换实测值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 12:
			utf.f = gPV_TFlow;//流量单位转换实测值
			pModbusHMIUpData=utf.u;
			break;
		case 13:
			utf.f = gPV_TPress_Out;//出液压力单位转换实测值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 14:
			utf.f = gPV_TPress_Out;//出液压力单位转换实测值
			pModbusHMIUpData=utf.u;
			break;
		case 15:
			utf.f = gPV_TPress_In;//回液压力单位转换实测值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 16:
			utf.f = gPV_TPress_In;//回液压力单位转换实测值
			pModbusHMIUpData=utf.u;
			break;
		case 17:
			utf.f = gPV_DI;//水质实测值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 18:
			utf.f = gPV_DI;//水质实测值
			pModbusHMIUpData=utf.u;
			break;
		case 19:
			pModbusHMIUpData=(FP.Para.Time_RunDelayComp + 1 - gTime_StopComp)/10;//倒计时时间
			break;
		case 20:
			utf.f = gSV_TTemp1;//主温度单位转换设定值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 21:
			utf.f = gSV_TTemp1;//主温度单位转换设定值
			pModbusHMIUpData=utf.u;
			break;
		case 22:
			utf.f = gSV_TTemp2;//辅温度单位转换设定值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 23:
			utf.f = gSV_TTemp2;//辅温度单位转换设定值
			pModbusHMIUpData=utf.u;
			break;
		case 24:
			utf.f = gSV_TFlow;//流量单位转换设定值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 25:
			utf.f = gSV_TFlow;//流量单位转换设定值
			pModbusHMIUpData=utf.u;
			break;
		case 28:
			utf.f = gSV_TPress;//压力单位转换设定值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 29:
			utf.f = gSV_TPress;//压力单位转换设定值
			pModbusHMIUpData=utf.u;
			break;
		case 30:
			pModbusHMIUpData=UP.Para.Type_FlowContr;//设备控流模式
			break;
		case 31:
			pModbusHMIUpData=UP.Para.Time_StopDelayPump;//停泵延时时间
			break;
		case 32:
			pModbusHMIUpData=gAlaFlag_Num;//故障与报警数量
			break;
		case 33:
			pModbusHMIUpData=UP.Para.Type_Display1;//主界面显示参数配置1
			break;
		case 34:
			pModbusHMIUpData=UP.Para.Type_Display2;//主界面显示参数配置2
			break;
		case 35:
			pModbusHMIUpData=gSV_Comp;//水泵目标值
			break;
		case 36:
			pModbusHMIUpData=rFlag_Comp;//变频器故障标志位
			break;
		case 37:
			pModbusHMIUpData=gState_Level;//液位图标
			break;
		case 38:
			pModbusHMIUpData=gState_CoolHeater;//制冷加热状态图标
			break;
		case 40:
			pModbusHMIUpData=rState_Alarm5;//报警状态组5
			break;
		case 45:
			pModbusHMIUpData=gLoading;//开机进度
			break;
		case 46:
			pModbusHMIUpData=gVersion;//软件版本
			break;
		case 50:
			utf.f = gProgram_TSP;//程序目标单位转换温度
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 51:
			utf.f = gProgram_TSP;//程序目标单位转换温度
			pModbusHMIUpData=utf.u;
			break;
		case 52:
			pModbusHMIUpData=gProgram_StableTime/2/60;//程序目标维持时长
			break;
		case 53:
			pModbusHMIUpData=gProgram_Step;//程序当前序号
			break;
		case 54:
			pModbusHMIUpData=gProgram_Time_ThisStep/2/60;//程序当前时间设置
			break;
		case 55:
			pModbusHMIUpData=UP.Para.ES_Program_Cycle;//程序循环使能
			break;
		case 56:
			pModbusHMIUpData=gProgram_State;//程序启停设置
			break;
		case 79:
			pModbusHMIUpData=UP.Para.ES_IO_Digital;//数字量输入输出使能
			break;
		case 80:
			pModbusHMIUpData=UP.Para.Digital_IO_Dispose;//数字量输入输出配置
			break;
		case 81:
			pModbusHMIUpData=UP.Para.Alarm_Out_Dispose1;//报警输出1配置
			break;
		case 82:
			pModbusHMIUpData=UP.Para.Alarm_Out_Dispose2;//报警输出2配置
			break;
		case 83:
			pModbusHMIUpData=UP.Para.Maintain_Out_Dispose;//维护输出配置
			break;
		case 84:
			pModbusHMIUpData=UP.Para.Digital_In1_Definition;//数字量输入1定义  DIN6
			break;
		case 85:
			pModbusHMIUpData=UP.Para.Digital_In2_Definition;//数字量输入2定义  DIN7
			break;
		case 88:
			pModbusHMIUpData=UP.Para.Digital_Out1_Definition;//数字量输出1定义  KA1
			break;
		case 89:
			pModbusHMIUpData=UP.Para.Digital_Out2_Definition;//数字量输出2定义  KA2
			break;
		case 100:
			pModbusHMIUpData=UP.Para.Type_Start;//启动模式设置
			break;
		case 101:
			pModbusHMIUpData=UP.Para.Type_TempContr;//控温模式设置
			break;
//		case 102:
//			pModbusHMIUpData=UP.Para.Type_Heater;//加热模式设置
//			break;
		case 103:
			pModbusHMIUpData=UP.Para.Type_Compensate;//补偿模式设置
			break;
		case 105:
			pModbusHMIUpData=UP.Para.Unit_Temp;//温度单位设定
			break;
		case 106:
			pModbusHMIUpData=UP.Para.Unit_Flow;//流量单位设定
			break;
		case 107:
			pModbusHMIUpData=UP.Para.Unit_Press;//压力单位设定
			break;
		case 108:
			pModbusHMIUpData=UP.Para.Unit_DI;//水质单位设定
			break;
		case 110:
			pModbusHMIUpData=gRunTime_RetunFluid;//气吹排液计时
			break;
		case 111:
			pModbusHMIUpData=gRunTime_RetunAir;//气吹排空计时
			break;
		case 112:
			pModbusHMIUpData=UP.Para.Time_RetunFluid;//气吹排液时长设置
			break;
		case 113:
			pModbusHMIUpData=UP.Para.Time_RetunAir;//气吹排空时长设置
			break;
		case 114:
			pModbusHMIUpData=gState_Return;//气吹启停设置
			break;
		case 115:
			utf.f = UP.Para.SV_Compensate;//手动温度补偿设定值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 116:
			utf.f = UP.Para.SV_Compensate;//手动温度补偿设定值
			pModbusHMIUpData=utf.u;
			break;
		case 117:
			utf.f = UP.Para.SV_AutoCompensate;//自动温度补偿设定值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 118:
			utf.f = UP.Para.SV_AutoCompensate;//自动温度补偿设定值
			pModbusHMIUpData=utf.u;
			break;
		case 120:
			pModbusHMIUpData=UP.Para.Type_Communication;//通讯模式选择
			break;
		case 121:
			pModbusHMIUpData=UP.Para.RS485_Addr;//通讯485地址
			break;
		case 122:
			pModbusHMIUpData=UP.Para.RS485_Speed;//通讯485速率
			break;
		case 123:
			pModbusHMIUpData=UP.Para.RS485_State;//通讯485状态
			break;
		case 134:
			pModbusHMIUpData=UP.Para.Type_HMI;//语种选择
			break;
		case 136:
			utf.f = gAlarm_HL_TTemp1;//报警单位转换温度上限1
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 137:
			utf.f = gAlarm_HL_TTemp1;//报警单位转换温度上限1
			pModbusHMIUpData=utf.u;
			break;
		case 138:
			utf.f = gAlarm_LL_TTemp1;//报警单位转换温度下限1
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 139:
			utf.f = gAlarm_LL_TTemp1;//报警单位转换温度下限1
			pModbusHMIUpData=utf.u;
			break;
		case 140:
			utf.f = gFLT_HL_TTemp1;//保护单位转换温度上限
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 141:
			utf.f = gFLT_HL_TTemp1;//保护单位转换温度上限
			pModbusHMIUpData=utf.u;
			break;
		case 142:
			utf.f = gFLT_LL_TTemp1;//保护单位转换温度下限
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 143:
			utf.f = gFLT_LL_TTemp1;//保护单位转换温度下限
			pModbusHMIUpData=utf.u;
			break;
		case 144:
			pModbusHMIUpData=UP.Para.AlarmType_TempHL;//报警温度上限检测模式
			break;
		case 145:
			pModbusHMIUpData=UP.Para.AlarmType_TempLL;//报警温度下限检测模式
			break;
		case 146:
			pModbusHMIUpData=UP.Para.AlarmType_Temp;//报警温度检测模式
			break;
//		case 147:
//			pModbusHMIUpData=UP.Para.AlarmStartTime_Temp/10;//报警温度检测延时
//			break;
//		case 148:
//			pModbusHMIUpData=UP.Para.AlarmOutTime_Temp/10;//报警温度确认时长
//			break;
		case 160:
			utf.f = gAlarm_LL_TFlow;//报警单位转换流量下限
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 161:
			utf.f = gAlarm_LL_TFlow;//报警单位转换流量下限
			pModbusHMIUpData=utf.u;
			break;
//		case 162:
//			pModbusHMIUpData=UP.Para.AlarmStartTime_Flow/10;//报警流量检测延时
//			break;
//		case 163:
//			pModbusHMIUpData=UP.Para.AlarmOutTime_Flow/10;//报警流量确认时长
//			break;
		case 164:
			pModbusHMIUpData=UP.Para.AlarmType_FlowLL;//报警流量下限检测模式
			break;
		case 165:
			pModbusHMIUpData=UP.Para.AlarmType_FlowSensor;//报警流量传感器检测模式
			break;
		case 168:
			pModbusHMIUpData=UP.Para.AlarmType_OverFlow;//溢流开关检测模式
			break;
		case 170:
			utf.f = gAlarm_HL_TPress;//报警单位转换出液压力上限
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 171:
			utf.f = gAlarm_HL_TPress;//报警单位转换出液压力上限
			pModbusHMIUpData=utf.u;
			break;
		case 172:
			utf.f = gAlarm_LL_TPress;//报警单位转换出液压力下限
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 173:
			utf.f = gAlarm_LL_TPress;//报警单位转换出液压力下限
			pModbusHMIUpData=utf.u;
			break;
		case 174:
			pModbusHMIUpData=UP.Para.AlarmType_PressHL;//报警压力上限检测模式
			break;
		case 175:
			pModbusHMIUpData=UP.Para.AlarmType_PressLL;//报警压力下限检测模式
			break;
		case 176:
			pModbusHMIUpData=UP.Para.AlarmType_OutPressSensor;//报警出液压力传感器检测模式
			break;
		case 177:
			pModbusHMIUpData=UP.Para.AlarmType_InPressSensor;//报警回液压力传感器检测模式
			break;
		case 180:
			utf.f = UP.Para.Alarm_LL_DI;//水质报警下限
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 181:
			utf.f = UP.Para.Alarm_LL_DI;//水质报警下限
			pModbusHMIUpData=utf.u;
			break;
		case 185:
			pModbusHMIUpData=UP.Para.AlarmType_Maint;//维护报警模式
			break;
		case 186:
			pModbusHMIUpData=gRunTime_Pump;//维护水泵运行时长
			break;
		case 187:
			pModbusHMIUpData=gRunTime_Comp;//维护压机运行时长
			break;
		case 188:
			pModbusHMIUpData=gRunTime_Filter;//维护过滤器运行时长
			break;
		case 189:
			pModbusHMIUpData=UP.Para.CycleTime_Filter;//维护过滤器周期
			break;
		case 200:
			utf.f = UP.Para.CaliTemp1_K;//温度校准1_K值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 201:
			utf.f = UP.Para.CaliTemp1_K;//温度校准1_K值
			pModbusHMIUpData=utf.u;
			break;
		case 202:
			utf.f = UP.Para.CaliTemp1_B;//温度校准1_B值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 203:
			utf.f = UP.Para.CaliTemp1_B;//温度校准1_B值
			pModbusHMIUpData=utf.u;
			break;
		case 204:
			utf.f = UP.Para.TempPID_P;//控温_P值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 205:
			utf.f = UP.Para.TempPID_P;//控温_P值
			pModbusHMIUpData=utf.u;
			break;
		case 206:
			utf.f = UP.Para.TempPID_I;//控温_I值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 207:
			utf.f = UP.Para.TempPID_I;//控温_I值
			pModbusHMIUpData=utf.u;
			break;
		case 208:
			utf.f = UP.Para.TempPID_D;//控温_D值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 209:
			utf.f = UP.Para.TempPID_D;//控温_D值
			pModbusHMIUpData=utf.u;
			break;
		case 210:
			utf.f = UP.Para.CaliFlow_K;//流量校准_K值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 211:
			utf.f = UP.Para.CaliFlow_K;//流量校准_K值
			pModbusHMIUpData=utf.u;
			break;
		case 212:
			utf.f = UP.Para.CaliFlow_B;//流量校准_B值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 213:
			utf.f = UP.Para.CaliFlow_B;//流量校准_B值
			pModbusHMIUpData=utf.u;
			break;
		case 214:
			utf.f = UP.Para.FlowPID_P;//控流_P值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 215:
			utf.f = UP.Para.FlowPID_P;//控流_P值
			pModbusHMIUpData=utf.u;
			break;
		case 216:
			utf.f = UP.Para.FlowPID_I;//控流_I值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 217:
			utf.f = UP.Para.FlowPID_I;//控流_I值
			pModbusHMIUpData=utf.u;
			break;
		case 218:
			utf.f = UP.Para.FlowPID_D;//控流_D值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 219:
			utf.f =UP.Para.FlowPID_D;//控流_D值
			pModbusHMIUpData=utf.u;
			break;
		case 220:
			utf.f = UP.Para.CaliTemp2_K;//温度校准2_K值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 221:
			utf.f = UP.Para.CaliTemp2_K;//温度校准2_K值
			pModbusHMIUpData=utf.u;
			break;
		case 222:
			utf.f = UP.Para.CaliTemp2_B;//温度校准2_B值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 223:
			utf.f = UP.Para.CaliTemp2_B;//温度校准2_B值
			pModbusHMIUpData=utf.u;
			break;
		case 224:
			utf.f = UP.Para.CaliTemp3_K;//温度校准3_K值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 225:
			utf.f = UP.Para.CaliTemp3_K;//温度校准3_K值
			pModbusHMIUpData=utf.u;
			break;
		case 226:
			utf.f = UP.Para.CaliTemp3_B;//温度校准3_B值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 227:
			utf.f = UP.Para.CaliTemp3_B;//温度校准3_B值
			pModbusHMIUpData=utf.u;
			break;
		case 228:
			pModbusHMIUpData=UP.Para.SV_TimeCompensate;//补偿温度自动计算时间系数
			break;
		case 229:
			utf.f = UP.Para.SV_AccuracyCompensate;//补偿温度调节死区
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 230:
			utf.f = UP.Para.SV_AccuracyCompensate;//补偿温度调节死区
			pModbusHMIUpData=utf.u;
			break;
		case 232:
			utf.f = UP.Para.TempPID_P1;//控温_P1值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 233:
			utf.f = UP.Para.TempPID_P1;//控温_P1值
			pModbusHMIUpData=utf.u;
			break;
		case 234:
			utf.f = UP.Para.TempPID_I1;//控温_I1值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 235:
			utf.f = UP.Para.TempPID_I1;//控温_I1值
			pModbusHMIUpData=utf.u;
			break;
		case 236:
			utf.f = UP.Para.TempPID_D1;//控温_D1值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 237:
			utf.f = UP.Para.TempPID_D1;//控温_D1值
			pModbusHMIUpData=utf.u;
			break;
		case 238:
			utf.f = UP.Para.TempPID_P3;//控温_P3值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 239:
			utf.f = UP.Para.TempPID_P3;//控温_P3值
			pModbusHMIUpData=utf.u;
			break;
		case 240:
			utf.f = UP.Para.TempPID_I3;//控温_I3值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 241:
			utf.f = UP.Para.TempPID_I3;//控温_I3值
			pModbusHMIUpData=utf.u;
			break;
		case 242:
			utf.f = UP.Para.TempPID_D3;//控温_D3值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 243:
			utf.f = UP.Para.TempPID_D3;//控温_D3值
			pModbusHMIUpData=utf.u;
			break;
		case 244:
			utf.f = UP.Para.CaliPress_K1;//出液压力校准_K1值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 245:
			utf.f = UP.Para.CaliPress_K1;//出液压力校准_K1值
			pModbusHMIUpData=utf.u;
			break;
		case 246:
			utf.f = UP.Para.CaliPress_B1;//出液压力校准_B1值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 247:
			utf.f = UP.Para.CaliPress_B1;//出液压力校准_B1值
			pModbusHMIUpData=utf.u;
			break;
		case 248:
			utf.f = UP.Para.CaliPress_K2;//出液压力校准_K2值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 249:
			utf.f = UP.Para.CaliPress_K2;//出液压力校准_K2值
			pModbusHMIUpData=utf.u;
			break;
		case 250:
			utf.f = UP.Para.CaliPress_B2;//出液压力校准_B2值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 251:
			utf.f = UP.Para.CaliPress_B2;//出液压力校准_B2值
			pModbusHMIUpData=utf.u;
			break;
		case 252:
			utf.f = UP.Para.CaliDI_K;//水质校准_K值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 253:
			utf.f = UP.Para.CaliDI_K;//水质校准_K值
			pModbusHMIUpData=utf.u;
			break;
		case 254:
			utf.f = UP.Para.CaliDI_B;//水质校准_B值
			pModbusHMIUpData=((uint16_t)(utf.u>>16));
			break;
		case 255:
			utf.f = UP.Para.CaliDI_B;//水质校准_B值
			pModbusHMIUpData=utf.u;
			break;
		default:
			break;
		}
	return pModbusHMIUpData;
}
uint16_t DRI_TxRegSwitchTo1000(unsigned int uiRegIndex)
{
	uint16_t pModbusHMIUpData;
	switch(uiRegIndex)
	{
	case 0:
		utf.f = gUpDownData2EEV1;//电子膨胀阀1开度
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 1:
		utf.f = gUpDownData2EEV1;//电子膨胀阀1开度
		pModbusHMIUpData=utf.u;
		break;
	case 2:
		pModbusHMIUpData=gUpDownData1EEV1;//电子膨胀阀1百分比
		break;
	case 3:
		pModbusHMIUpData=gEnableDataEEV1;//电子膨胀阀1确定
		break;
	case 4:
		utf.f = gUpDownData2EEV2;//电子膨胀阀2开度
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 5:
		utf.f = gUpDownData2EEV2;//电子膨胀阀2开度
		pModbusHMIUpData=utf.u;
		break;
	case 6:
		pModbusHMIUpData=gUpDownData1EEV2;//电子膨胀阀2百分比
		break;
	case 7:
		pModbusHMIUpData=gEnableDataEEV2;//电子膨胀阀2确定
		break;
	case 8:
		utf.f = gUpDownData2EEV3;//电子膨胀阀3开度
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 9:
		utf.f = gUpDownData2EEV3;//电子膨胀阀3开度
		pModbusHMIUpData=utf.u;
		break;
	case 10:
		pModbusHMIUpData=gUpDownData1EEV3;//电子膨胀阀3百分比
		break;
	case 11:
		pModbusHMIUpData=gEnableDataEEV3;//电子膨胀阀3确定
		break;
	case 12:
		utf.f = gSlaver_Temp1;//从机温度输入1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 13:
		utf.f = gSlaver_Temp1;//从机温度输入1
		pModbusHMIUpData=utf.u;
		break;
	case 14:
		utf.f = gSlaver_Temp2;//从机温度输入2
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 15:
		utf.f = gSlaver_Temp2;//从机温度输入2
		pModbusHMIUpData=utf.u;
		break;
	case 16:
		utf.f = gSlaver_Temp3;//从机温度输入3
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 17:
		utf.f = gSlaver_Temp3;//从机温度输入3
		pModbusHMIUpData=utf.u;
		break;
	case 18:
		utf.f = gSlaver_Press1;//从机压力1输入
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 19:
		utf.f = gSlaver_Press1;//从机压力1输入
		pModbusHMIUpData=utf.u;
		break;
	case 20:
		utf.f = gSlaver_Press2;//从机压力2输入
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 21:
		utf.f = gSlaver_Press2;//从机压力2输入
		pModbusHMIUpData=utf.u;
		break;
	case 22:
		utf.f = gSlaver_Press_Temp1;//从机压力1饱和温度
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 23:
		utf.f = gSlaver_Press_Temp1;//从机压力1饱和温度
		pModbusHMIUpData=utf.u;
		break;
	case 24:
		utf.f = gSlaver_Superhest_Press1;//从机压力1过热度
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 25:
		utf.f = gSlaver_Superhest_Press1;//从机压力1过热度
		pModbusHMIUpData=utf.u;
		break;
	case 32:
		utf.f = gSlaver_P;//从机P值
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 33:
		utf.f = gSlaver_P;//从机P值
		pModbusHMIUpData=utf.u;
		break;
	case 34:
		utf.f = gSlaver_I;//从机I值
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 35:
		utf.f = gSlaver_I;//从机I值
		pModbusHMIUpData=utf.u;
		break;
	case 36:
		utf.f = gSlaver_D;//从机D值
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 37:
		utf.f = gSlaver_D;//从机D值
		pModbusHMIUpData=utf.u;
		break;
	case 38:
		utf.f = gSlaver_PID;//从机PID和
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 39:
		utf.f = gSlaver_PID;//从机PID和
		pModbusHMIUpData=utf.u;
		break;
	case 40:
		utf.f = gSlaver_ValuePID;//从机PID平均值
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 41:
		utf.f = gSlaver_ValuePID;//从机PID平均值
		pModbusHMIUpData=utf.u;
		break;
	case 42:
		utf.f = gSlaver_Press_Temp2;//从机压力2饱和温度
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 43:
		utf.f = gSlaver_Press_Temp2;//从机压力2饱和温度
		pModbusHMIUpData=utf.u;
		break;
	case 44:
		utf.f = gSlaver_Supercold_Press2;//从机压力2过冷度
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 45:
		utf.f = gSlaver_Supercold_Press2;//从机压力2过冷度
		pModbusHMIUpData=utf.u;
		break;
	case 47:
		pModbusHMIUpData=gSlaver_Version;//D4306软件版本
		break;
	case 48:
		pModbusHMIUpData=gSlaver_Ref;//从机冷媒种类
		break;
	case 49:
		pModbusHMIUpData=gFlag_Auto;//电子膨胀阀控制方式标志
		break;
	default:
		break;
	}
	return pModbusHMIUpData;
}
uint16_t DRI_TxRegSwitchTo1500(unsigned int uiRegIndex)
{
	uint16_t pModbusHMIUpData;
	switch(uiRegIndex)
	{
	case 0:
		utf.f = FP.Para.HL_TempPV;//温度测量上限1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 1:
		utf.f = FP.Para.HL_TempPV;//温度测量上限1
		pModbusHMIUpData=utf.u;
		break;
	case 2:
		utf.f = FP.Para.LL_TempPV;//温度测量下限1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 3:
		utf.f = FP.Para.LL_TempPV;//温度测量下限1
		pModbusHMIUpData=utf.u;
		break;
	case 4:
		utf.f = gHL_TempSV1;//温度单位转换控制上限1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 5:
		utf.f = gHL_TempSV1;//温度单位转换控制上限1
		pModbusHMIUpData=utf.u;
		break;
	case 6:
		utf.f = gLL_TempSV1;//温度单位转换控制下限1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 7:
		utf.f = gLL_TempSV1;//温度单位转换控制下限1
		pModbusHMIUpData=utf.u;
		break;
	case 12:
		utf.f = FP.Para.SV_Alarm_Press1;//从机氟压1报警下限值
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 13:
		utf.f = FP.Para.SV_Alarm_Press1;//从机氟压1报警下限值
		pModbusHMIUpData=utf.u;
		break;
	case 14:
		pModbusHMIUpData=FP.Para.SV_AlarmTime_Press1/10;//从机氟压1报警确认时间
		break;
	case 15:
		utf.f = FP.Para.SV_Alarm_Press2;//从机氟压2报警下限值
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 16:
		utf.f = FP.Para.SV_Alarm_Press2;//从机氟压2报警下限值
		pModbusHMIUpData=utf.u;
		break;
	case 17:
		pModbusHMIUpData=FP.Para.SV_AlarmTime_Press2/10;//从机氟压2报警确认时间
		break;
	case 20:
		utf.f = FP.Para.HL_FlowPV;//流量测量上限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 21:
		utf.f = FP.Para.HL_FlowPV;//流量测量上限
		pModbusHMIUpData=utf.u;
		break;
	case 22:
		utf.f = FP.Para.LL_FlowPV;//流量测量下限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 23:
		utf.f = FP.Para.LL_FlowPV;//流量测量下限
		pModbusHMIUpData=utf.u;
		break;
	case 24:
		utf.f = FP.Para.HL_FlowSV;//流量控制上限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 25:
		utf.f = FP.Para.HL_FlowSV;//流量控制上限
		pModbusHMIUpData=utf.u;
		break;
	case 26:
		utf.f = FP.Para.LL_FlowSV;//流量控制下限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 27:
		utf.f = FP.Para.LL_FlowSV;//流量控制下限
		pModbusHMIUpData=utf.u;
		break;
	case 28:
		utf.f = FP.Para.HL_TempFF;//保护温度上限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 29:
		utf.f = FP.Para.HL_TempFF;//保护温度上限
		pModbusHMIUpData=utf.u;
		break;
	case 30:
		utf.f = FP.Para.LL_TempFF;//保护温度下限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 31:
		utf.f = FP.Para.LL_TempFF;//保护温度下限
		pModbusHMIUpData=utf.u;
		break;
	case 32:
		utf.f = FP.Para.LL_FlowFF;//冷冻水保护流量下限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 33:
		utf.f = FP.Para.LL_FlowFF;//冷冻水保护流量下限
		pModbusHMIUpData=utf.u;
		break;
	case 34:
		pModbusHMIUpData=FP.Para.AlarmStartTime_Temp/10;//报警温度检测延时
		break;
	case 35:
		pModbusHMIUpData=FP.Para.AlarmOutTime_Temp/10;//报警温度确认时长
		break;
	case 36:
		utf.f = FP.Para.HL_PressPV;//压力测量上限1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 37:
		utf.f = FP.Para.HL_PressPV;//压力测量上限1
		pModbusHMIUpData=utf.u;
		break;
	case 38:
		utf.f = FP.Para.LL_PressPV;//压力测量下限1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 39:
		utf.f = FP.Para.LL_PressPV;//压力测量下限1
		pModbusHMIUpData=utf.u;
		break;
	case 40:
		utf.f = FP.Para.HL_PressSV;//压力控制上限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 41:
		utf.f = FP.Para.HL_PressSV;//压力控制上限
		pModbusHMIUpData=utf.u;
		break;
	case 42:
		utf.f = FP.Para.LL_PressSV;//压力控制下限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 43:
		utf.f = FP.Para.LL_PressSV;//压力控制下限
		pModbusHMIUpData=utf.u;
		break;
	case 44:
		utf.f = FP.Para.HL_DI_PV;//电阻率测量上限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 45:
		utf.f = FP.Para.HL_DI_PV;//电阻率测量上限
		pModbusHMIUpData=utf.u;
		break;
	case 46:
		utf.f = FP.Para.LL_DI_PV;//电阻率测量下限
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 47:
		utf.f = FP.Para.LL_DI_PV;//电阻率测量下限
		pModbusHMIUpData=utf.u;
		break;
	case 48:
		utf.f = FP.Para.K_FlowPulse;//流量脉冲系数1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 49:
		utf.f = FP.Para.K_FlowPulse;//流量脉冲系数1
		pModbusHMIUpData=utf.u;
		break;
	case 52:
		utf.f = FP.Para.D_Value_CT;//启停式压机控温回差值
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 53:
		utf.f = FP.Para.D_Value_CT;//启停式压机控温回差值
		pModbusHMIUpData=utf.u;
		break;
	case 54:
		pModbusHMIUpData=FP.Para.Fre_Pump_MAX;//水泵变频器最大操作频率
		break;
	case 55:
		pModbusHMIUpData=FP.Para.Fre_Pump_MIN;//水泵变频器最小操作频率
		break;
	case 56:
		pModbusHMIUpData=FP.Para.Digital_In1_Definition;//数字量输入1定义  DIN5
		break;
	case 57:
		pModbusHMIUpData=FP.Para.Digital_In2_Definition;//数字量输入2定义  DIN4
		break;
	case 58:
		pModbusHMIUpData=FP.Para.Digital_Out1_Definition;//数字量输出1定义  KA3
		break;
	case 59:
		pModbusHMIUpData=FP.Para.Digital_Out2_Definition;//数字量输出2定义  KA2
		break;
	case 61:
		pModbusHMIUpData=FP.Para.Type_CompNumber;//压缩机级数设置
		break;
	case 62:
		pModbusHMIUpData=FP.Para.Tepy_Comp;//压缩机控制模式设置
		break;
	case 63:
		pModbusHMIUpData=FP.Para.Tepy_Cool;//风/水冷机设置
		break;
	case 65:
		pModbusHMIUpData=FP.Para.RunTime_Chiller;//维护设备运行时长
		break;
	case 66:
		pModbusHMIUpData=FP.Para.Time_RunDelayComp/10;//启动压缩机延时时间
		break;
	case 67:
		pModbusHMIUpData=FP.Para.ES_Temp2;//辅温度使能
		break;
	case 68:
		pModbusHMIUpData=FP.Para.ES_TempAmbi;//环境温度使能
		break;
	case 69:
		pModbusHMIUpData=FP.Para.ES_Flow;//流量检测使能
		break;
	case 70:
		pModbusHMIUpData=FP.Para.ES_Press_Out;//出液压力检测使能
		break;
	case 71:
		pModbusHMIUpData=FP.Para.ES_Press_In;//回液压力检测使能
		break;
	case 72:
		pModbusHMIUpData=FP.Para.ES_DI;//水质检测使能
		break;
	case 73:
		pModbusHMIUpData=FP.Para.ES_COWFlowLL;//冷却水流量下限检测使能
		break;
	case 74:
		pModbusHMIUpData=FP.Para.ES_InFlowLL;//低流量检测使能
		break;
	case 75:
		pModbusHMIUpData=FP.Para.ES_FlowContr;//流量控制使能
		break;
	case 76:
		pModbusHMIUpData=FP.Para.ES_DI_Contr;//水质控制使能
		break;
	case 77:
		pModbusHMIUpData=FP.Para.ES_ReturnContr;//自动回液使能
		break;
	case 78:
		uti.i = FP.Para.SV_Temp_OpenLowValve;//打开低温制冷阀温度
		pModbusHMIUpData=uti.u;
		break;
	case 79:
		uti.i = FP.Para.SV_Temp_CloseLowValve;//关闭低温制冷阀温度
		pModbusHMIUpData=uti.u;
		break;
	case 80:
		uti.i = FP.Para.SV_Temp_OpenHighValve;//打开高温制冷阀温度
		pModbusHMIUpData=uti.u;
		break;
	case 81:
		uti.i = FP.Para.SV_Temp_CloseHighValve;//关闭高温制冷阀温度
		pModbusHMIUpData=uti.u;
		break;
	case 83:
		pModbusHMIUpData=FP.Para.Type_HL_TempFF;//保护温度上限模式
		break;
	case 84:
		pModbusHMIUpData=FP.Para.Type_LL_TempFF;//保护温度下限模式
		break;
	case 85:
		pModbusHMIUpData=FP.Para.Type_LL_Flow;//冷冻水保护流量下限检测模式
		break;
	case 86:
		pModbusHMIUpData=FP.Para.Type_LL_Level;//低液位报警检测模式
		break;
	case 87:
		pModbusHMIUpData=FP.Para.Type_Heater;//加热模式设置
		break;
	case 88:
		pModbusHMIUpData=FP.Para.AlarmStartTime_Flow/10;//报警流量检测延时
		break;
	case 89:
		pModbusHMIUpData=FP.Para.AlarmOutTime_Flow/10;//报警流量确认时长
		break;
	case 90:
		pModbusHMIUpData=gSTATE_TempCalibration;//工厂温度校准状态
		break;
	case 91:
		pModbusHMIUpData=sav.Para.pptAD1[0];//温度1校准点AD值1
		break;
	case 92:
		pModbusHMIUpData=sav.Para.pptAD1[1];//温度1校准点AD值2
		break;
	case 93:
		pModbusHMIUpData=sav.Para.pptAD1[2];//温度1校准点AD值3
		break;
	case 94:
		pModbusHMIUpData=sav.Para.pptAD1[3];//温度1校准点AD值4
		break;
	case 95:
		pModbusHMIUpData=sav.Para.pptAD1[4];//温度1校准点AD值5
		break;
	case 96:
		pModbusHMIUpData=sav.Para.pptAD1[5];//温度1校准点AD值6
		break;
	case 97:
		pModbusHMIUpData=sav.Para.pptAD1[6];//温度1校准点AD值7
		break;
	case 98:
		pModbusHMIUpData=sav.Para.pptAD1[7];//温度1校准点AD值8
		break;
	case 99:
		pModbusHMIUpData=sav.Para.pptAD1[8];//温度1校准点AD值9
		break;
	case 100:
		pModbusHMIUpData=sav.Para.pptAD1[9];//温度1校准点AD值10
		break;
	case 123:
		pModbusHMIUpData=FP.Para.Digital_In3_Definition;//数字量输入3定义  DIN3
		break;
	case 124:
		pModbusHMIUpData=FP.Para.Digital_In4_Definition;//数字量输入4定义  DIN7
		break;
	case 125:
		pModbusHMIUpData=FP.Para.Com_Mode;//通讯协议选择
		break;
	case 130:
		pModbusHMIUpData=FP.Para.EEV1_Min;//制冷电磁阀降温下限值
		break;
	case 132:
		pModbusHMIUpData=FP.Para.ES_Te;//蒸发温度传感器使能
		break;
	case 133:
		pModbusHMIUpData=FP.Para.ES_Tc;//冷凝温度传感器使能
		break;
	case 134:
		pModbusHMIUpData=FP.Para.ES_To;//出气温度传感器使能
		break;
	case 135:
		pModbusHMIUpData=FP.Para.ES_Pc;//冷凝压力传感器使能
		break;
	case 136:
		pModbusHMIUpData=FP.Para.EW_Pc;//冷凝压力开关使能
		break;
	case 140:
		pModbusHMIUpData=FP.Para.ES_EEV3;//高温辅助制冷电子膨胀阀使能
		break;
	case 141:
		utf.f = FP.Para.Tup1;//高温辅助制冷电子膨胀阀上限温度1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 142:
		utf.f = FP.Para.Tup1;//高温辅助制冷电子膨胀阀上限温度1
		pModbusHMIUpData=utf.u;
		break;
	case 143:
		utf.f = FP.Para.Tup2;//高温辅助制冷电子膨胀阀上限温度2
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 144:
		utf.f = FP.Para.Tup2;//高温辅助制冷电子膨胀阀上限温度2
		pModbusHMIUpData=utf.u;
		break;
	case 145:
		utf.f = FP.Para.Tdown1;//高温辅助制冷电子膨胀阀下限温度1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 146:
		utf.f = FP.Para.Tdown1;//高温辅助制冷电子膨胀阀下限温度1
		pModbusHMIUpData=utf.u;
		break;
	case 147:
		utf.f = FP.Para.Tdown2;//高温辅助制冷电子膨胀阀下限温度2
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 148:
		utf.f = FP.Para.Tdown2;//高温辅助制冷电子膨胀阀下限温度2
		pModbusHMIUpData=utf.u;
		break;
	case 151:
		utf.f = FP.Para.HL_TempPV_Te1;//蒸发温度报警上限值1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 152:
		utf.f = FP.Para.HL_TempPV_Te1;//蒸发温度报警上限值1
		pModbusHMIUpData=utf.u;
		break;
	case 153:
		utf.f = FP.Para.LL_TempPV_Te1;//蒸发温度报警下限值1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 154:
		utf.f = FP.Para.LL_TempPV_Te1;//蒸发温度报警下限值1
		pModbusHMIUpData=utf.u;
		break;
	case 155:
		utf.f = FP.Para.HL_TempPV_To1;//出气温度报警上限值1
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 156:
		utf.f = FP.Para.HL_TempPV_To1;//出气温度报警上限值1
		pModbusHMIUpData=utf.u;
		break;
	case 157:
		utf.f = FP.Para.LL_PassPV_Te1_nm;//氟压平衡低压报警值
		pModbusHMIUpData=((uint16_t)(utf.u>>16));
		break;
	case 158:
		utf.f = FP.Para.LL_PassPV_Te1_nm;//氟压平衡低压报警值
		pModbusHMIUpData=utf.u;
		break;
	case 159:
		pModbusHMIUpData = FP.Para.Type_Press1;//蒸发压力下限设置模式
		break;
	default:
}
	return pModbusHMIUpData;
}
/**
* @函数名	DRI_TxRegHMIValue
* @功能	    将03指令需要的数据填充到相应的寄存器中
* @入口参数	无
* @返回值	无
*/
void DRI_TxRegHMIValue(unsigned int uiRegIndex)
{
	uint16_t pModbusHMIUpData;

	if(uiRegIndex < 500)
		pModbusHMIUpData = DRI_TxRegSwitchTo500(uiRegIndex-100);
	else if(uiRegIndex < 1000)
		pModbusHMIUpData = DRI_TxRegSwitchTo1000(uiRegIndex-500);
	else if(uiRegIndex < 1500)
		pModbusHMIUpData = DRI_TxRegSwitchTo1500(uiRegIndex-1000);

	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=(uint8_t)(pModbusHMIUpData>>8);
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=(uint8_t)(pModbusHMIUpData&0x00ff);
}

/**
* @函数名	DRI_HMIUpStartTx
* @功能	    USAUT1发送数据函数
* @入口参数	无
* @返回值	无
*/
void DRI_HMIUpStartTx(void)
{
	BSP_Usart_SendU8(USART1,pBus232_HMI_TxBuffer,pBus232_HMI_TxCounter);
}

/**
* @函数名	DRI_ProcessModbusHMIUpCmd3
* @功能	    03指令解析处理并向HMI发送数据
* @入口参数	无
* @返回值	无
*/
void DRI_ProcessModbusHMIUpCmd3(void)
{
	uint16_t uiStart;
	uint16_t uiQuantity;
	uint16_t uiEnd;
	uint16_t i;

	//字节个数
	uiQuantity=((uint16_t)gBus232_HMI_RxBuffer[4]<<8)+gBus232_HMI_RxBuffer[5];
	if(uiQuantity>0x7D)
	{
		//ExceptionResponse(0x03);
		return;
	}
	//起始地址
	uiStart=((uint16_t)gBus232_HMI_RxBuffer[2]<<8)+gBus232_HMI_RxBuffer[3]+1;
	//结束地址
	uiEnd = uiStart + uiQuantity;
//		if(ModbusUpListenOnly)
//		{
//			ModbusUpUartInit();
//			return;
//		}
	pBus232_HMI_TxCounter=0;
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=gBus232_HMI_RxBuffer[0];
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=gBus232_HMI_RxBuffer[1];
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=uiQuantity*2;
	for(i = uiStart; i < uiEnd; i++)
	{
		DRI_TxRegHMIValue(i);
	}
	DRI_MakeModbusHMIUpMsgCrc();
	DRI_HMIUpStartTx();
}

/**
* @函数名	DRI_ProcessModbusHMIUpCmd6
* @功能	    06指令解析处理并向HMI发送数据
* @入口参数	无
* @返回值	无
*/
void DRI_ProcessModbusHMIUpCmd6(void)
{
	uint16_t uiStart;
	uint16_t uiQuantity=0;
	uint16_t uiData=0;
	uint8_t pFlag_Save = 1;  //保存标志位

	if(uiQuantity>0x7D)
	{
		//ExceptionResponse(0x03);
		return;
	}
	uiStart=((uint16_t)gBus232_HMI_RxBuffer[2]<<8)+gBus232_HMI_RxBuffer[3]+1;
	uiData=((gBus232_HMI_RxBuffer[4]<<8) + gBus232_HMI_RxBuffer[5]);
//	if(ModbusUpListenOnly)
//	{
//		ModbusUpUartInit();
//		return;
//	}
	pBus232_HMI_TxCounter=0;
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=gBus232_HMI_RxBuffer[0];
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=gBus232_HMI_RxBuffer[1];

	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=gBus232_HMI_RxBuffer[2];
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=gBus232_HMI_RxBuffer[3];

	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=gBus232_HMI_RxBuffer[4];
	pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++]=gBus232_HMI_RxBuffer[5];
	DRI_MakeModbusHMIUpMsgCrc();
	DRI_HMIUpStartTx();

	if(uiStart >= 0)
	{
		switch(uiStart)
		{
		case 1014:
			FP.Para.SV_AlarmTime_Press1=10 * uiData;//从机氟压1报警确认时间
			pFlag_Save = 0;
			break;
		case 1017:
			FP.Para.SV_AlarmTime_Press2=10*uiData;//从机氟压1报警确认时间
			pFlag_Save = 0;
			break;
		case 1034:
			FP.Para.AlarmStartTime_Temp=10*uiData;//报警温度检测延时
			pFlag_Save = 0;
			break;
		case 1035:
			FP.Para.AlarmOutTime_Temp=10*uiData;//报警温度确认时长
			pFlag_Save = 0;
			break;
		case 1054:
			FP.Para.Fre_Pump_MAX=uiData;//水泵变频器最大操作频率
			pFlag_Save = 0;
			break;
		case 1055:
			FP.Para.Fre_Pump_MIN=uiData;//水泵变频器最小操作频率
			pFlag_Save = 0;
			break;
		case 1056:
			FP.Para.Digital_In1_Definition=uiData;//数字量输入1定义  DIN5
			pFlag_Save = 0;
			break;
		case 1057:
			FP.Para.Digital_In2_Definition=uiData;//数字量输入2定义  DIN4
			pFlag_Save = 0;
			break;
		case 1058:
			FP.Para.Digital_Out1_Definition=uiData;//数字量输出1定义  KA3
			pFlag_Save = 0;
			break;
		case 1059:
			FP.Para.Digital_Out2_Definition=uiData;//数字量输出2定义  KA2
			pFlag_Save = 0;
			break;
		case 1061:
			FP.Para.Type_CompNumber=gBus232_HMI_RxBuffer[5];//压缩机级数设置
			pFlag_Save = 0;
			break;
		case 1062:
			FP.Para.Tepy_Comp=gBus232_HMI_RxBuffer[5];//压缩机控制模式设置
			pFlag_Save = 0;
			break;
		case 1063:
			FP.Para.Tepy_Cool=gBus232_HMI_RxBuffer[5];//风/水冷机设置
			pFlag_Save = 0;
			break;
		case 1065:
		    FP.Para.RunTime_Chiller=uiData;//维护设备运行时长
		    pFlag_Save = 0;
			break;
		case 1066:
		    FP.Para.Time_RunDelayComp=10*uiData;//启动压缩机延时时间
		    pFlag_Save = 0;
			break;
		case 1067:
			FP.Para.ES_Temp2=gBus232_HMI_RxBuffer[5];//辅温度使能
			pFlag_Save = 0;
			break;
		case 1068:
			FP.Para.ES_TempAmbi=gBus232_HMI_RxBuffer[5];//环境温度使能
			pFlag_Save = 0;
			break;
		case 1069:
			FP.Para.ES_Flow=gBus232_HMI_RxBuffer[5];//流量检测使能
			pFlag_Save = 0;
			break;
		case 1070:
			FP.Para.ES_Press_Out=gBus232_HMI_RxBuffer[5];//出液压力检测使能
			pFlag_Save = 0;
			break;
		case 1071:
			FP.Para.ES_Press_In=gBus232_HMI_RxBuffer[5];//回液压力检测使能
			pFlag_Save = 0;
			break;
		case 1072:
			FP.Para.ES_DI=gBus232_HMI_RxBuffer[5];//水质检测使能
			pFlag_Save = 0;
			break;
		case 1073:
			FP.Para.ES_COWFlowLL=gBus232_HMI_RxBuffer[5];//冷却水流量下限检测使能
			pFlag_Save = 0;
			break;
		case 1074:
			FP.Para.ES_InFlowLL=gBus232_HMI_RxBuffer[5];//内循环低流量检测使能
			pFlag_Save = 0;
			break;
		case 1075:
			FP.Para.ES_FlowContr=gBus232_HMI_RxBuffer[5];//流量控制使能
			pFlag_Save = 0;
			break;
		case 1076:
			FP.Para.ES_DI_Contr=gBus232_HMI_RxBuffer[5];//水质控制使能
			pFlag_Save = 0;
			break;
		case 1077:
			FP.Para.ES_ReturnContr=gBus232_HMI_RxBuffer[5];//自动回液使能
			pFlag_Save = 0;
			break;
		case 1078:
			uti.u = uiData;//打开低温制冷阀温度
			FP.Para.SV_Temp_OpenLowValve=uti.i;
			pFlag_Save = 0;
			break;
		case 1079:
			uti.u = uiData;//关闭低温制冷阀温度
			FP.Para.SV_Temp_CloseLowValve=uti.i;
			pFlag_Save = 0;
			break;
		case 1080:
			uti.u = uiData;//打开高温制冷阀温度
			FP.Para.SV_Temp_OpenHighValve=uti.i;
			pFlag_Save = 0;
			break;
		case 1081:
			uti.u = uiData;//关闭高温制冷阀温度
			FP.Para.SV_Temp_CloseHighValve=uti.i;
			pFlag_Save = 0;
			break;
		case 1083:
			FP.Para.Type_HL_TempFF=gBus232_HMI_RxBuffer[5];//保护温度上限模式
			pFlag_Save = 0;
			break;
		case 1084:
			FP.Para.Type_LL_TempFF=gBus232_HMI_RxBuffer[5];//保护温度下限模式
			pFlag_Save = 0;
			break;
		case 1085:
			FP.Para.Type_LL_Flow=gBus232_HMI_RxBuffer[5];//冷冻水保护流量下限检测模式
			pFlag_Save = 0;
			break;
		case 1086:
			FP.Para.Type_LL_Level=gBus232_HMI_RxBuffer[5];//低液位报警检测模式
			pFlag_Save = 0;
			break;
		case 1087:
			FP.Para.Type_Heater=gBus232_HMI_RxBuffer[5];//加热模式设置
			pFlag_Save = 0;
			break;
		case 1088:
			FP.Para.AlarmStartTime_Flow=10*uiData;//报警流量检测延时
			pFlag_Save = 0;
			break;
		case 1089:
			FP.Para.AlarmOutTime_Flow=10*uiData;//报警流量确认时长
			pFlag_Save = 0;
			break;
		case 1123:
			FP.Para.Digital_In3_Definition=uiData;//数字量输入3定义  DIN3
			pFlag_Save = 0;
			break;
		case 1124:
			FP.Para.Digital_In4_Definition=uiData;//数字量输入4定义  DIN7
			pFlag_Save = 0;
			break;
		case 1125:
			FP.Para.Com_Mode=uiData;//通讯协议选择
			pFlag_Save = 0;
			break;
		case 1130:
			FP.Para.EEV1_Min=gBus232_HMI_RxBuffer[5];//制冷电磁阀降温下限值
			pFlag_Save = 0;
			break;
		case 1132:
			FP.Para.ES_Te = gBus232_HMI_RxBuffer[5];//蒸发温度传感器使能
			pFlag_Save = 0;
			break;
		case 1133:
			FP.Para.ES_Tc=gBus232_HMI_RxBuffer[5];//冷凝温度传感器使能
			pFlag_Save = 0;
			break;
		case 1134:
			FP.Para.ES_To=gBus232_HMI_RxBuffer[5];//出气温度传感器使能
			pFlag_Save = 0;
			break;
		case 1135:
			FP.Para.ES_Pc=gBus232_HMI_RxBuffer[5];//冷凝压力传感器使能
			pFlag_Save = 0;
			break;
		case 1136:
			FP.Para.EW_Pc=gBus232_HMI_RxBuffer[5];//冷凝压力开关使能
			pFlag_Save = 0;
			break;
		case 1090:
			gSTATE_TempCalibration=uiData;//工厂温度校准状态
			pFlag_Save = 0;
			break;
		case 1140:
			FP.Para.ES_EEV3=gBus232_HMI_RxBuffer[5];//高温辅助制冷电子膨胀阀使能
			pFlag_Save = 0;
			break;
		case 1159:
			FP.Para.Type_Press1=gBus232_HMI_RxBuffer[5];//蒸发压力下限设置模式
			pFlag_Save = 0;
			break;
		case 100:
			rState_Chiller=uiData;//设备状态组
			pFlag_Save = 0;
			break;
		case 103:
			UP.Para.Type_FlowContr=gBus232_HMI_RxBuffer[5];//设备控流模式
			break;
		case 119:
			gTime_StopComp=10*uiData - 99;//停压机停机  处理后计时
			pFlag_Save = 0;
			break;
		case 130:
			UP.Para.Type_FlowContr=gBus232_HMI_RxBuffer[5];//设备控流模式
			break;
		case 131:
			UP.Para.Time_StopDelayPump=uiData;//停泵延时时间
			break;
		case 133:
			UP.Para.Type_Display1=gBus232_HMI_RxBuffer[5];//主界面显示参数配置1
			break;
		case 134:
			UP.Para.Type_Display2=gBus232_HMI_RxBuffer[5];//主界面显示参数配置2
			break;
		case 145:
			gLoading=gBus232_HMI_RxBuffer[5];//开机进度
			pFlag_Save = 0;
			break;
		case 153:
			gProgram_Step=uiData;//程序当前序号
			pFlag_Save = 0;
			break;
		case 154:
			gProgram_Time_ThisStep=2*60*uiData;//程序当前时间设置
			pFlag_Save = 0;
			break;
		case 155:
			UP.Para.ES_Program_Cycle=gBus232_HMI_RxBuffer[5];//程序循环使能
			break;
		case 156:
			gProgram_State=gBus232_HMI_RxBuffer[5];//程序启停设置
			pFlag_Save = 0;
			break;
		case 179:
			UP.Para.ES_IO_Digital=gBus232_HMI_RxBuffer[5];//程序启停设置
			break;
		case 180:
			UP.Para.Digital_IO_Dispose=uiData;//数字量输入输出配置
			break;
		case 181:
			UP.Para.Alarm_Out_Dispose1=uiData;//报警输出1配置
			break;
		case 182:
			UP.Para.Alarm_Out_Dispose2=uiData;//报警输出2配置
			break;
		case 183:
			UP.Para.Maintain_Out_Dispose=uiData;//维护输出配置
			break;
		case 184:
			UP.Para.Digital_In1_Definition=uiData;//数字量输入1定义  DIN6
			break;
		case 185:
			UP.Para.Digital_In2_Definition=uiData;//数字量输入2定义  DIN7
			break;
		case 188:
			UP.Para.Digital_Out1_Definition=uiData;//数字量输出1定义  KA1
			break;
		case 189:
			UP.Para.Digital_Out2_Definition=uiData;//数字量输出2定义  KA2
			break;
		case 200:
			UP.Para.Type_Start=gBus232_HMI_RxBuffer[5];//启动模式设置
			break;
		case 201:
			UP.Para.Type_TempContr=gBus232_HMI_RxBuffer[5];//控温模式设置
			break;
//		case 202:
//			UP.Para.Type_Heater=gBus232_HMI_RxBuffer[5];//加热模式设置
//			break;
		case 203:
			UP.Para.Type_Compensate=gBus232_HMI_RxBuffer[5];//补偿模式设置
			break;
		case 205:
			UP.Para.Unit_Temp=gBus232_HMI_RxBuffer[5];//温度单位设定
			break;
		case 206:
			UP.Para.Unit_Flow=gBus232_HMI_RxBuffer[5];//流量单位设定
			break;
		case 207:
			UP.Para.Unit_Press=gBus232_HMI_RxBuffer[5];//压力单位设定
			break;
		case 208:
			UP.Para.Unit_DI=gBus232_HMI_RxBuffer[5];//水质单位设定
			break;
		case 212:
			UP.Para.Time_RetunFluid=uiData;//气吹排液时长设置
			break;
		case 213:
			UP.Para.Time_RetunAir=uiData;//气吹排空时长设置
			break;
		case 214:
			gState_Return=gBus232_HMI_RxBuffer[5];//气吹启停设置
			pFlag_Save = 0;
			break;
		case 220:
			UP.Para.Type_Communication=gBus232_HMI_RxBuffer[5];//通讯模式选择
			break;
		case 221:
			UP.Para.RS485_Addr=uiData;//通讯485地址
			break;
		case 222:
			UP.Para.RS485_Speed=uiData;//通讯485速率
			break;
		case 223:
			UP.Para.RS485_State=gBus232_HMI_RxBuffer[5];//通讯485状态
			break;
		case 230:
			gRestoryUP=gBus232_HMI_RxBuffer[5];//恢复用户默认设置
			pFlag_Save = 0;
			break;
		case 231:
			gSaveUP=gBus232_HMI_RxBuffer[5];//保存用户默认设置
			pFlag_Save = 0;
			break;
		case 232:
			gRestoryFP=gBus232_HMI_RxBuffer[5];//恢复工厂出厂设置
			pFlag_Save = 0;
			break;
		case 233:
			gSaveFP=gBus232_HMI_RxBuffer[5];//保存工厂出厂设置
			pFlag_Save = 0;
			break;
		case 234:
			UP.Para.Type_HMI=gBus232_HMI_RxBuffer[5];//语种选择
			break;
		case 244:
			UP.Para.AlarmType_TempHL=gBus232_HMI_RxBuffer[5];//报警温度上限检测模式
			break;
		case 245:
			UP.Para.AlarmType_TempLL=gBus232_HMI_RxBuffer[5];//报警温度下限检测模式
			break;
		case 246:
			UP.Para.AlarmType_Temp=gBus232_HMI_RxBuffer[5];//报警温度检测模式
			break;
//		case 247:
//			UP.Para.AlarmStartTime_Temp=10*uiData;//报警温度检测延时
//			break;
//		case 248:
//			UP.Para.AlarmOutTime_Temp=10*uiData;//报警温度确认时长
//			break;
//		case 262:
//			UP.Para.AlarmStartTime_Flow=10*uiData;//报警流量检测延时
//			break;
//		case 263:
//			UP.Para.AlarmOutTime_Flow=10*uiData;//报警流量确认时长
//			break;
		case 264:
			UP.Para.AlarmType_FlowLL=gBus232_HMI_RxBuffer[5];//报警流量下限检测模式
			break;
		case 265:
			UP.Para.AlarmType_FlowSensor=gBus232_HMI_RxBuffer[5];//报警流量传感器检测模式
			break;
		case 268:
			UP.Para.AlarmType_OverFlow=gBus232_HMI_RxBuffer[5];//溢流开关检测模式
			break;
		case 274:
			UP.Para.AlarmType_PressHL=gBus232_HMI_RxBuffer[5];//报警压力上限检测模式
			break;
		case 275:
			UP.Para.AlarmType_PressLL=gBus232_HMI_RxBuffer[5];//报警压力下限检测模式
			break;
		case 276:
			UP.Para.AlarmType_OutPressSensor=gBus232_HMI_RxBuffer[5];//报警出液压力传感器检测模式
			break;
		case 277:
			UP.Para.AlarmType_InPressSensor=gBus232_HMI_RxBuffer[5];//报警回液压力传感器检测模式
			break;
		case 285:
			UP.Para.AlarmType_Maint=gBus232_HMI_RxBuffer[5];//维护报警模式
			break;
		case 286:
			gRunTime_Pump=uiData;//维护水泵运行时长
			pFlag_Save = 0;
			break;
		case 287:
			gRunTime_Comp=uiData;//维护压机运行时长
			pFlag_Save = 0;
			break;
		case 288:
			gRunTime_Filter=uiData;//维护过滤器运行时长
			pFlag_Save = 0;
			break;
		case 289:
			UP.Para.CycleTime_Filter=uiData;//维护过滤器周期
			break;
		case 295:
			rMaintFlag_Reset = gBus232_HMI_RxBuffer[5];//维护时长复位组
			pFlag_Save = 0;
			break;
		case 328:
			UP.Para.SV_TimeCompensate=uiData;//补偿温度自动计算时间系数
			break;
		case 502:
			gUpDownData1EEV1=uiData;//电子膨胀阀1百分比
			pFlag_Save = 0;
			break;
		case 503:
			gEnableDataEEV1 = gBus232_HMI_RxBuffer[5];//电子膨胀阀1确定
			pFlag_Save = 0;
			break;
		case 506:
			gUpDownData1EEV2=uiData;//电子膨胀阀2百分比
			pFlag_Save = 0;
			break;
		case 507:
			gEnableDataEEV2 = gBus232_HMI_RxBuffer[5];//电子膨胀阀2确定
			pFlag_Save = 0;
			break;
		case 510:
			gUpDownData1EEV3=uiData;//电子膨胀阀3百分比
			pFlag_Save = 0;
			break;
		case 511:
			gEnableDataEEV3 = gBus232_HMI_RxBuffer[5];//电子膨胀阀3确定
			pFlag_Save = 0;
			break;
		case 549:
			gFlag_Auto=gBus232_HMI_RxBuffer[5];//电子膨胀阀控制方式标志
			pFlag_Save = 0;
			break;
			default:
				break;
		}

		if(pFlag_Save == 1)  //需要存储的参数
		{
			DRI_Flash_Erase_4KByte(ADDR_USER_PARA);//写入前擦除
			DRI_Flash_AAI_WriteBuffer(&UP.flashBuff[0], ADDR_USER_PARA, 500);//写入用户初值到buff中
		}
	}
}
#if 1
/**
* @函数名	DRI_ProcessModbusHMIUpCmd16
* @功能	    16指令解析处理并向HMI发送数据
* @入口参数	无
* @返回值	无
*/
void DRI_ProcessModbusHMIUpCmd16(void)
{
	uint16_t uiStart;
	uint16_t uiEnd;
	uint16_t uiQuantity;
	uint16_t i;
	uint8_t pFlag_Save = 1;  //保存标志位

//	uint8_t FlagCmdModbus = 0;
	//寄存器个数
	uiQuantity=((uint16_t)gBus232_HMI_RxBuffer[4]<<8)+gBus232_HMI_RxBuffer[5];
	if(uiQuantity>0x7D)
	{
		//ExceptionResponse(0x03);
		return;
	}
	//寄存器起始地址
	uiStart=((uint16_t)gBus232_HMI_RxBuffer[2]<<8)+gBus232_HMI_RxBuffer[3]+1;
	//结束地址
	uiEnd=uiStart+uiQuantity;
	utf.u = ((uint32_t)gBus232_HMI_RxBuffer[7]<<24)+((uint32_t)gBus232_HMI_RxBuffer[8]<<16)+((uint32_t)gBus232_HMI_RxBuffer[9]<<8)+((uint32_t)gBus232_HMI_RxBuffer[10]);
	for(i=uiStart;i<uiEnd;i++)
	{
		 switch(i)
		 {
			case 1000:  //温度测量上限1
				FP.Para.HL_TempPV = utf.f;
				pFlag_Save = 0;
				break;
			case 1002:  //温度测量下限1
				FP.Para.LL_TempPV = utf.f;
				pFlag_Save = 0;
				break;
			case 1004:  //温度单位转换控制上限1
				gHL_TempSV1 = utf.f;
				gFlag_T = 1;
				break;
			case 1006:  //温度单位转换控制下限1
				gLL_TempSV1 = utf.f;
				gFlag_T = 1;
				break;
			case 1012:  //从机氟压1报警下限值
				FP.Para.SV_Alarm_Press1 = utf.f;
				pFlag_Save = 0;
				break;
			case 1015:  //从机氟压2报警下限值
				FP.Para.SV_Alarm_Press2 = utf.f;
				pFlag_Save = 0;
				break;
			case 1020:  //流量测量上限
				FP.Para.HL_FlowPV = utf.f;
				pFlag_Save = 0;
				break;
			case 1022:  //流量测量下限
				FP.Para.LL_FlowPV = utf.f;
				pFlag_Save = 0;
				break;
			case 1024:  //流量控制上限
				FP.Para.HL_FlowSV = utf.f;
				pFlag_Save = 0;
				break;
			case 1026:  //流量控制下限
				FP.Para.LL_FlowSV = utf.f;
				pFlag_Save = 0;
				break;
			case 1028:  //保护温度上限
				FP.Para.HL_TempFF = utf.f;
				pFlag_Save = 0;
				break;
			case 1030:  //保护温度下限
				FP.Para.LL_TempFF = utf.f;
				pFlag_Save = 0;
				break;
			case 1032:  //冷冻水保护流量下限
				FP.Para.LL_FlowFF = utf.f;
				pFlag_Save = 0;
				break;
			case 1036:  //压力测量上限1
				FP.Para.HL_PressPV = utf.f;
				pFlag_Save = 0;
				break;
			case 1038:  //压力测量下限1
				FP.Para.LL_PressPV = utf.f;
				pFlag_Save = 0;
				break;
			case 1040:  //压力控制上限
				FP.Para.HL_PressSV = utf.f;
				pFlag_Save = 0;
				break;
			case 1042:  //压力控制下限
				FP.Para.LL_PressSV = utf.f;
				pFlag_Save = 0;
				break;
			case 1044:  //电阻率测量上限
				FP.Para.HL_DI_PV = utf.f;
				pFlag_Save = 0;
				break;
			case 1046:  //电阻率测量下限
				FP.Para.LL_DI_PV = utf.f;
				pFlag_Save = 0;
				break;
			case 1048:  //流量脉冲系数1
				FP.Para.K_FlowPulse = utf.f;
				pFlag_Save = 0;
				break;
			case 1052:  //启停式压机控温回差值
				FP.Para.D_Value_CT = utf.f;
				pFlag_Save = 0;
				break;
			case 1141:  //高温辅助制冷电子膨胀阀上限温度1
				FP.Para.Tup1 = utf.f;
				pFlag_Save = 0;
				break;
			case 1143:  //高温辅助制冷电子膨胀阀上限温度2
				FP.Para.Tup2 = utf.f;
				pFlag_Save = 0;
				break;
			case 1145:  //高温辅助制冷电子膨胀阀下限温度1
				FP.Para.Tdown1 = utf.f;
				pFlag_Save = 0;
				break;
			case 1147:  //高温辅助制冷电子膨胀阀下限温度2
				FP.Para.Tdown2 = utf.f;
				pFlag_Save = 0;
				break;
			case 1151:  //蒸发温度报警上限值1
				FP.Para.HL_TempPV_Te1 = utf.f;
				pFlag_Save = 0;
				break;
			case 1153:  //蒸发温度报警下限值1
				FP.Para.LL_TempPV_Te1 = utf.f;
				pFlag_Save = 0;
				break;
			case 1155:  //出气温度报警上限值1
				FP.Para.HL_TempPV_To1 = utf.f;
				pFlag_Save = 0;
				break;
			case 1157:  //氟压平衡低压报警值
				FP.Para.LL_PassPV_Te1_nm = utf.f;
				pFlag_Save = 0;
				break;
			case 120:  //主温度单位转换设定值
				gSV_TTemp1 = utf.f;
				gFlag_T = 1;
				break;
			case 122:  //辅温度单位转换设定值
				gSV_TTemp2 = utf.f;
				gFlag_T = 1;
				break;
			case 124:  //流量单位转换设定值
				gSV_TFlow = utf.f;
				gFlag_T = 1;
				break;
			case 128:  //压力单位转换设定值
				gSV_TPress = utf.f;
				gFlag_T = 1;
				break;
			case 150:  //程序目标单位转换温度
				gProgram_TSP = utf.f;
				gFlag_T = 1;
				pFlag_Save = 0;
				break;
			case 215:  //手动温度补偿设定值
				UP.Para.SV_Compensate = utf.f;
				break;
			case 216:  //手动温度补偿设定值
				UP.Para.SV_Compensate = utf.f;
				break;
			case 236:  //报警单位转换温度上限1
				gAlarm_HL_TTemp1 = utf.f;
				gFlag_T = 1;
				break;
			case 238:  //报警单位转换温度下限1
				gAlarm_LL_TTemp1 = utf.f;
				gFlag_T = 1;
				break;
			case 240:  //保护单位转换温度上限
				gFLT_HL_TTemp1 = utf.f;
				gFlag_T = 1;
				break;
			case 242:  //保护单位转换温度下限
				gFLT_LL_TTemp1 = utf.f;
				gFlag_T = 1;
				break;
			case 260:  //报警单位转换流量下限
				gAlarm_LL_TFlow = utf.f;
				gFlag_T = 1;
				break;
			case 270:  //报警单位转换出液压力上限
				gAlarm_HL_TPress = utf.f;
				gFlag_T = 1;
				break;
			case 272:  //报警单位转换出液压力下限
				gAlarm_LL_TPress = utf.f;
				gFlag_T = 1;
				break;
			case 280:  //水质报警下限
				UP.Para.Alarm_LL_DI = utf.f;
				break;
			case 300:  //温度校准1_K值
				UP.Para.CaliTemp1_K = utf.f;
				break;
			case 302:  //温度校准1_B值
				UP.Para.CaliTemp1_B = utf.f;
				break;
			case 304:  //控温_P值
				UP.Para.TempPID_P = utf.f;
				break;
			case 306:  //控温_I值
				UP.Para.TempPID_I = utf.f;
				break;
			case 308:  //控温_D值
				UP.Para.TempPID_D = utf.f;
				break;
			case 310:  //流量校准_K值
				UP.Para.CaliFlow_K = utf.f;
				break;
			case 312:  //流量校准_B值
				UP.Para.CaliFlow_B = utf.f;
				break;
			case 314:  //控流_P值
				UP.Para.FlowPID_P = utf.f;
				break;
			case 316:  //控流_I值
				UP.Para.FlowPID_I = utf.f;
				break;
			case 318:  //控流_D值
				UP.Para.FlowPID_D = utf.f;
				break;
			case 320:  //温度校准2_K值
				UP.Para.CaliTemp2_K = utf.f;
				break;
			case 322:  //温度校准2_B值
				UP.Para.CaliTemp2_B = utf.f;
				break;
			case 324:  //温度校准3_K值
				UP.Para.CaliTemp3_K = utf.f;
				break;
			case 326:  //温度校准3_B值
				UP.Para.CaliTemp3_B = utf.f;
				break;
			case 329:  //补偿温度调节死区
				UP.Para.SV_AccuracyCompensate = utf.f;
				break;
			case 332:  //控温_P1值
				UP.Para.TempPID_P1 = utf.f;
				break;
			case 334:  //控温_I1值
				UP.Para.TempPID_I1 = utf.f;
				break;
			case 336:  //控温_D1值
				UP.Para.TempPID_D1 = utf.f;
				break;
			case 338:  //控温_P3值
				UP.Para.TempPID_P3 = utf.f;
				break;
			case 340:  //控温_I3值
				UP.Para.TempPID_I3 = utf.f;
				break;
			case 342:  //控温_D3值
				UP.Para.TempPID_D3 = utf.f;
				break;
			case 344:  //出液压力校准_K1值
				UP.Para.CaliPress_K1 = utf.f;
				break;
			case 346:  //出液压力校准_B1值
				UP.Para.CaliPress_B1 = utf.f;
				break;
			case 348:  //出液压力校准_K2值
				UP.Para.CaliPress_K2 = utf.f;
				break;
			case 350:  //出液压力校准_B2值
				UP.Para.CaliPress_B2 = utf.f;
				break;
			case 352:  //水质校准_K值
				UP.Para.CaliDI_K = utf.f;
				break;
			case 354:  //水质校准_B值
				UP.Para.CaliDI_B = utf.f;
				break;
			case 500:  //电子膨胀阀1开度
				gUpDownData2EEV1 = utf.f;
				pFlag_Save = 0;
				break;
			case 504:  //电子膨胀阀2开度
				gUpDownData2EEV2 = utf.f;
				pFlag_Save = 0;
				break;
			case 508:  //电子膨胀阀3开度
				gUpDownData2EEV3 = utf.f;
				pFlag_Save = 0;
				break;
			default:
				break;
		}
	}

	if(gFlag_T == 1)  //需要单位转换后存储
	{
		gFlag_T = 0;
	    //温度单位转换
	    if(UP.Para.Unit_Temp == 0)  //摄氏度-摄氏度
	    {
	    	gProgram_SP = gProgram_TSP;
	    	UP.Para.SV_Temp1 = gSV_TTemp1;
	    	UP.Para.SV_Temp2 = gSV_TTemp2;
	    	UP.Para.Alarm_HL_Temp1 = gAlarm_HL_TTemp1;
			UP.Para.Alarm_LL_Temp1 = gAlarm_LL_TTemp1;
			UP.Para.FLT_HL_Temp1 = gFLT_HL_TTemp1;
			UP.Para.FLT_LL_Temp1 = gFLT_LL_TTemp1;
			FP.Para.HL_TempSV1 = gHL_TempSV1;
			FP.Para.LL_TempSV1 = gLL_TempSV1;
	    }
	    else  //华氏度-摄氏度
	    {
	    	gProgram_SP = (gProgram_TSP - 32) / 1.8;
	    	UP.Para.SV_Temp1 = (gSV_TTemp1 - 32) / 1.8;
	    	UP.Para.SV_Temp2 = (gSV_TTemp2 - 32) / 1.8;
	    	UP.Para.Alarm_HL_Temp1 = (gAlarm_HL_TTemp1 - 32) / 1.8;
			UP.Para.Alarm_LL_Temp1 = (gAlarm_LL_TTemp1 - 32) / 1.8;
			UP.Para.FLT_HL_Temp1 = (gFLT_HL_TTemp1 - 32) / 1.8;
			UP.Para.FLT_LL_Temp1 = (gFLT_LL_TTemp1 - 32) / 1.8;
			FP.Para.HL_TempSV1 = (gHL_TempSV1 - 32) / 1.8;
			FP.Para.LL_TempSV1 = (gLL_TempSV1 - 32) / 1.8;
	    }

	    //流量单位转换
	    if(UP.Para.Unit_Flow == 0)  //LPM-LPM
	    {
	    	UP.Para.SV_Flow = gSV_TFlow;
	    	UP.Para.Alarm_LL_Flow = gAlarm_LL_TFlow;
	    }
	    else  //TPH-LPM
	    {
	    	UP.Para.SV_Flow =  gSV_TFlow / 0.06;
	    	UP.Para.Alarm_LL_Flow = gAlarm_LL_TFlow / 0.6;
	    }

	    //压力单位转换
	    if(UP.Para.Unit_Press == 0)  //kPa-kPa
	    {
	    	UP.Para.SV_Press = gSV_TPress;
	    	UP.Para.Alarm_HL_Press = gAlarm_HL_TPress;
	    	UP.Para.Alarm_LL_Press = gAlarm_LL_TPress;
	    }
	    else  //psi-psi
	    {
	    	UP.Para.SV_Press= gSV_TPress  / 0.1450377;
	    	UP.Para.Alarm_HL_Press = gAlarm_HL_TPress / 0.1450377;
	    	UP.Para.Alarm_LL_Press = gAlarm_LL_TPress / 0.1450377;
	    }
	}

	if(pFlag_Save == 1)
	{
		DRI_Flash_Erase_4KByte(ADDR_USER_PARA);//写入前擦除
		DRI_Flash_AAI_WriteBuffer(&UP.flashBuff[0], ADDR_USER_PARA, 500);//写入用户初值到buff中
	}

//    if(FlagCmdModbus==1)
//    {
//    	FlagCmdModbus = 0;
    	pBus232_HMI_TxCounter = 0;
		pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++] = gBus232_HMI_RxBuffer[0];
		pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++] = gBus232_HMI_RxBuffer[1];
		pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++] = gBus232_HMI_RxBuffer[2];
		pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++] = gBus232_HMI_RxBuffer[3];
		pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++] = gBus232_HMI_RxBuffer[4];
		pBus232_HMI_TxBuffer[pBus232_HMI_TxCounter++] = gBus232_HMI_RxBuffer[5];
	    DRI_MakeModbusHMIUpMsgCrc();
	    DRI_HMIUpStartTx();
//    }
}
#endif
/**
* @函数名	Task_HMI_RX_Integration
* @功能	    RS232接收数据处理
* @入口参数	无
* @返回值	无
*/
void DRI_HMI_RX_Integration(void)
{
	uint16_t puiCRCResult;
	uint8_t pModbusUpFrameHMIStatus=0;

	if(gBus232_HMI_RxCounter<3) //如果数据字节少于3
	{
		pModbusUpFrameHMIStatus=1;
	}
	else
	{
		uint16_t crcdata;
//		Crc16Arg.pCrc16ArgsPuchMsg=gBus232_HMI_RxBuffer;  //获取等待CRC数组地址
//		Crc16Arg.crc16ArgsPuchMsgLen=gBus232_HMI_RxCounter-2;  //获取等待CRC数组长度  不包含原CRC
		puiCRCResult = Crc16(gBus232_HMI_RxBuffer, gBus232_HMI_RxCounter-2);
//		puiCRCResult=Crc16Arg.returnValue;  //得到CRC数值
		crcdata = ((gBus232_HMI_RxBuffer[gBus232_HMI_RxCounter-1]<<8)|gBus232_HMI_RxBuffer[gBus232_HMI_RxCounter-2]);
		gBus232_HMI_RxCounter = 0;
		if((crcdata - puiCRCResult) == 0)//CRC校验通过
		{
			pModbusUpFrameHMIStatus=0;  //接收成功
		}
		else
		{
			pModbusUpFrameHMIStatus=1;//接收失败
		}
	}
	if(pModbusUpFrameHMIStatus==0)
	{
		if(gBus232_HMI_RxBuffer[0]==0x01)
		{
			switch(gBus232_HMI_RxBuffer[1])  //判断指令
			{
				case 3://读多个寄存器
					DRI_ProcessModbusHMIUpCmd3();
					break;
				case 6://写单个寄存器
					DRI_ProcessModbusHMIUpCmd6();
					break;
				case 16://写多个寄存器
					DRI_ProcessModbusHMIUpCmd16();
					break;
				default:
				break;
			}
		}
	}
}






